package com.kongfuzi.proxy;
//娱乐共同的约束--接口
interface Enterment {
	public abstract void dance();
	void sing();
}
//真实对象---演员类
class Actor implements Enterment{

	private String name;//演员名称

	public Actor(String name) {
		super();
		this.name = name;
	}

	public void dance() {
		System.out.println(name+"跳舞......");
	}

	public void sing() {
		System.out.println(name+"唱歌.....");
	}
}
//代理对象---中间人,代理人, 知名社会活动家
class MiddleMan implements Enterment{
	private  String name;//姓名
	private Actor actor;//被代理的演员对象

	public MiddleMan(String name, Actor actor) {
		super();
		this.name = name;
		this.actor = actor;
	}

	public void dance() {
		System.out.println(name + " 哥们收点好处费.....");
		actor.dance();
		System.out.println(name+ " 下次继续合作...");
	}

	public void sing() {
		System.out.println("--开始唱歌-----");
		actor.sing();
		System.out.println("--结束唱歌-----");
	}
}
public class Test {

	public static void main(String[] args) {
		Actor actor = new Actor("宝宝");//创建一个演员
		MiddleMan mm = new MiddleMan("宋喆",actor);
		mm.dance();
		mm.sing();
	}
}